﻿using System.Data.Entity;

namespace QcRiverFlows.Models
{
    public class RiverFlowsContext : DbContext
    {
        // You can add custom code to this file. Changes will not be overwritten.
        // 
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, add the following
        // code to the Application_Start method in your Global.asax file.
        // Note: this will destroy and re-create your database with every model change.
        // 
        // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<QcRiverFlows.Models.RiverFlowsContext>());


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<Region>().ToTable("xRegions");
            modelBuilder.Entity<Flow>().ToTable("Sections");

        }


        public DbSet<River> Rivers { get; set; }

        public DbSet<Category> Categories { get; set; }

        public DbSet<Section> Sections { get; set; }

        public DbSet<Region> Regions { get; set; }

        public DbSet<Flow> Flows { get; set; }
    }
}
